/*
 * @Author: 飞越疯人院 353362604@qq.com
 * @Date: 2022-09-15 16:48:46
 * @LastEditors: 飞越疯人院 353362604@qq.com
 * @LastEditTime: 2023-02-15 17:30:35
 * @FilePath: \adminstration\src\Common\Modal\TwoModalList\LabReportTemplates.jsx
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import { API_LIST } from '../../Api/Api'
import { TwoAddBtn } from '../options'
import { commonTableList } from '../config'
import { setFieldPropsOptions } from '../../Router/MenuBoxList'

export const GantryCraneCameras = async ({ upDataEvent, data, ClientData, Permission }) => {
    let dataList = {
        type: '龙门吊摄像头列表',
        hideInSearch: true,
        pageSize: 10,
        params: {},
        classification: 'TableModal',
        get: API_LIST([])['getGantryCrane'],
        additional: { key: 'PushFlowConfigUuid', value: 'uuid' },
        options: [
            Permission.findIndex(v => v.uuid === '5eada254-b285-4667-ab13-b7d8689935ce') !== -1 && (
                <TwoAddBtn
                    upDataEvent={upDataEvent}
                    title="添加摄像头"
                    ThrKey="ThrModal"
                    value="GantryCraneCameras"
                    data={data}
                />
            ),
        ],
        columns: [
            {
                title: '人员id',
                dataIndex: 'userUuid',
                search: false,
                type: 'hidden',
                hideInTable: true,
            },
            { ...commonTableList.organizationUuid, valueEnum: ClientData.organization },
            {
                title: '摄像头名称',
                dataIndex: 'tableName',
                search: false,
            },
            {
                dataIndex: 'cameraPositionUuid',
                title: '摄像头位置',
                valueType: 'treeSelect',
                fieldProps: {
                    options: [],
                    fieldNames: { label: 'tableName', value: 'uuid' },
                },
            },
            {
                title: '摄像头类型',
                dataIndex: 'cameraTypeUuid',
                valueEnum: ClientData.cameraType,
            },
        ],
    }

    dataList.columns.find(v => v.dataIndex === 'cameraPositionUuid').fieldProps.options = await setFieldPropsOptions({
        url: 'getCameraPositionTree',
    })
    return dataList
}
